package ils.web.action;

import ils.domain.issue.model.Item;
import ils.services.AdminService;

import java.util.Map;

import ils.services.IssueService;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

public class AddItemAction extends ActionSupport implements SessionAware
{
    private Map<String, Object> session;
    private int bookId;
    private Item item;
    private int branchId;
    private int shelfId;
    private AdminService adminService;
    private IssueService issueService;

    public String execute() throws Exception
    {
        if(item == null) return INPUT;
        issueService.addItem(item, shelfId);
        return SUCCESS;
    }
    
    @Override
    public void setSession(Map<String, Object> arg0)
    {
       this.session = arg0;
    }

    public int getBookId()
    {
        return bookId;
    }

    public void setBookId(int bookId)
    {
        this.bookId = bookId;
    }

    public Item getItem()
    {
        return item;
    }

    public void setItem(Item item)
    {
        this.item = item;
    }

    public void setAdminService(AdminService adminService)
    {
        this.adminService = adminService;
    }

    public int getBranchId()
    {
        return branchId;
    }

    public void setBranchId(int branchId)
    {
        this.branchId = branchId;
    }

    public int getShelfId()
    {
        return shelfId;
    }

    public void setShelfId(int shelfId)
    {
        this.shelfId = shelfId;
    }

}
